package net.tensor.tensor.oauth.server.service;

import net.tensor.tensor.oauth.server.entity.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

/**
 * @author Q
 */
@Service(value = "MyUserDetailsServiceImpl")
public class UserDetailsServiceImpl implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        User user=new User();
        user.setUsername("q");
        user.setPassword(new BCryptPasswordEncoder().encode("q"));
        user.setAccessToken("123");
        user.setCode("123");
        user.setRefreshToken("321");
        return user;
    }
}
